from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token
from .views import statistical, users, specs, images
from rest_framework.routers import DefaultRouter


urlpatterns = [
    # 登陆路由
    url(r'^authorizations/$', obtain_jwt_token),
    # ----------用户统计------------
    # 用户总量统计
    url(r'^statistical/total_count/$', statistical.UserCountView.as_view()),
    # 日曾统计
    url(r'^statistical/day_increment/$', statistical.UserDayCountView.as_view()),
    # 日活用户统计
    url(r'^statistical/day_active/$', statistical.UserActiveCount.as_view()),
    # 日下单数量统计
    url(r'^statistical/day_orders/$', statistical.UserOrderCount.as_view()),
    # 月增用户统计
    url(r'^statistical/month_increment/$', statistical.UserOrderMonthCount.as_view()),
    # 日分类商品访问量
    url(r'^statistical/goods_day_views/$', statistical.GoodsDayView.as_view()),

    # ------------用户管理------------------
    url(r'^users/$', users.UserView.as_view()),
    # --------------规格表路由---------------
    url(r'^goods/sile/$', specs.SpecsView.as_view({'get': 'simple'})),
    # ------------ 图片路由---------------------
    url(r'^skus/simple/$', images.ImagesView.as_view({'get': 'simple'})),

]
# --------------规格表路由---------------
router = DefaultRouter()
router.register('goods/specs', specs.SpecsView, base_name='specs')
print(router.urls)
urlpatterns += router.urls

# -------------图片表路由----------------
router = DefaultRouter()
router.register('skus/images', images.ImagesView, base_name='images')
print(router.urls)
urlpatterns += router.urls